/*
Copyright (C) 2008  Helmut Juskewycz
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.juskewycz.dividere.action.split;

import com.juskewycz.dividere.core.*;

/**
 * A Splitter allows to split a file into several small file pieces.
 *
 * @author Helmut Juskewycz
 * @createdon 27. January 2008
 * @lastmodified 27. January 2008
 * @history
 * 27. January 2008 Finished version 1.0
 */
public interface ISplitter {

    //constants for messages regarding the splitting process
    public static final String ERROR_FILE_IO = "errorFileIOMessage";
    public static final String ERROR_THREAD_INTERUPTION = "errorGeneralMessage";
    public static final String ERROR_SPLIT_SIZE_INVALID = "errorSplitSizeInvalid";
    public static final String ERROR_SPLIT_FILE_PATH_NULL = "errorSplitFilePathNull";
    public static final String ERROR_SPLIT_FILE_NOT_EXISTS = "errorSplitFileNotExists";
    public static final String ERROR_CANT_CREATE_PART_FILE = "errorCantCreatePartFile";

    /**
     * Splits a large into several smaller part files. The file pieces will be
     * named to the schema _name_._extension_001, _name_._extension_002, ...
     * 
     * @param filePath The path of the original (large) file.
     * @param splitSize The size of the part files.
     */
    public void split(String filePath, long splitSize);

    /**
     * Adds a split listener to the splitter.
     * 
     * @param listener The listener which will be added.
     */
    public void addListener(ISplitListener listener);

    /**
     * Removes a split listener from the splitter.
     * 
     * @param listener The listener which will be removed.
     */
    public void removeListener(ISplitListener listener);
}
